﻿using Avalonia.Controls;
using DocumentMaking.Lib.Models;
using DocumentMaking.Lib.Services;

namespace DocumentMaking.FluentNext.Dialogs;

public partial class AddMemberDialog : UserControl
{
    public AddMemberDialog()
    {
        InitializeComponent();
    }

    public MemberModel? Done()
    {
        if (string.IsNullOrEmpty(NameBox.Text) || string.IsNullOrEmpty(IdBox.Text)) return default;
        if (!IDVerificationService.CheckId(IdBox.Text) || !IDVerificationService.CheckName(NameBox.Text))
            return default;
        return new MemberModel() { Name = NameBox.Text ,ID = IdBox.Text};
    }
}